package niuke.string;

import java.util.Scanner;

/**
 * @author liyuhui
 * @date {DATE}
 * @description
 */
public class FindCountInString {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        String character = scanner.nextLine();

        System.out.println(findCountInString(word,character));

    }

    private static int findCountInString(String word,String character) {
        if (!isNotEmpty(word)){
            return 0;
        }

        String wordNew = word.toLowerCase();
        char characterNew =  character.toLowerCase().charAt(0);
        int count = 0;

        for (int i = 0; i < wordNew.length(); i++) {
            if (wordNew.charAt(i) == characterNew){
                count ++;
            }
        }
        return count;
    }

    private static boolean isNotEmpty(String str1) {
        if (str1 != null && str1.trim().length() !=0){
            return true;
        }else return false;
    }
}
